Decoding Student Stress: An Exploration of Factors Contributing to College Student Well-Being

Column

Background

Academic stress, typically psychological in nature, is something that almost every college student has experienced. Stress can lead to the activation of the hypothlamic-pituitary-adrenal axis which releases cortisol. Cortisol is able to provide the cells with extra energy to overcome the stressor but prolonged activation may lead to HPA axis dysregulation. Chronic dysregulation can be attributed to negative health outcomes, both physical and psychological in nature (Westberg et al., 2022).

Motivation

There is a reported increase in mental health conditions in younger generations, including in college students (Stephens & Wand, 2012). This project aims to explore the impact of different factors on a student’s mental well-being and the possible role of animals to mediate stress. As a psychology major, I picked this data set as it is realted to my field of interest.

Research Questions

This analysis aims to explore the following research questions:

  • What is the relationship between academic factors of GPA, credit hours and class?

  • How do academic factors impact levels of perceived life stress?

  • Is there a relationship between having a pet at home and psychological well-being?

  • Does spending time with a therapy dog reduce physiological stress?

Column

Data Source and Citation

Source

The data was obtained through ICPSR and is licensed under a “Creative Commons Attribution.” The data was collected in an experiment that took place at the University of Washington. Subjective psychological measures were self reported by participants and physiological data was collected via saliva for later analysis.

Citation

Pendry, Patricia, and VandaGriff, Jaymie . PYSA . Ann Arbor, MI: Inter-university Consortium for Political and Social Research [distributor], 2019-12-18. https://doi.org/10.3886/E116768V1

Analysis Tools

Manipulation

The original data set contained over 200 variables, many were not relevant to the focus of this analysis and the research questions. Using the dplyr package, I removed data for those that had only completed one part of the study. This was necessary because those participants didn’t provide saliva samples so there was no physiological data.I also had to create a new variable called “GPA_group”, this allowed me to further examine the relationship between academic variables and psychological variables.

I picked GPA, credit hours, and class as a representation of academic factors. In order to access stress, I choose the stress total variable over the others as it uses the Perceived Stress Scale to examine one’s overall perception of life stress. The psychological variables of interest are anxiety and depression. I had to create a group based on clinical evidence of the conditions in order to visualize the role of a pet at home on mental health. To examine the role of the therapy animal I decided to use cortisol area under the curve and average cortisol.

Visualization

In order to assess the relationship between two or more quantitative variables, I utilized a scatter plot with a line to better visualize the correlation. Box plots were also used to examine the distribution of quantitative variables. Box plots were particularly helpful in investigating the distribution of qualitative variables based on quantitative variables. Bar charts were utilized for clear visualizations of the distribution of qualitative variables.

Column

Data

Column

Variable Descriptions

  • ID: participant ID
  • Group: group that participant was in
    • Experimental: 1 on 1 time with animal
    • Slideshow: shown pictures of therapy animals for 10 minutes
    • Observation: observe others interacting with therapy animals
    • Waitlist: control, waited in stimuli free room
  • Age: participant age
  • Sex: participant sex
  • Class: participant’s current year of college
  • Credit hours: total number of credit hours taken in semester
  • Rounded GPA: participant’s rounded GPA
  • GPA group: GPA group
  • Pet: whether a participant has a pet at home
  • Depression total: score on Beck Depression Inventory
  • Anxiety total: score on Beck Anxiety Inventory
  • Stress total: score on Perceived Stress Scale
  • Clinical anxiety: grouping based on anxiety total score
  • Clinical depression: grouping based on depression total score
  • Cortisol AUC: analysis of cortisol rate of change from pre to post
  • Average Cortisol: average cortisol across timepoints
  • Extreme Cortisol: cortisol reading of at least 3 SD above mean

Column

Distribution of Gender by Group

Distribution of Gender by Age

Column

Analysis

These graphs give a brief overview on the make up of participants. A few things should be noted:

  • There are a total of 249 participants
  • There are more female than male participants in the study. Female participants dominate male participants in every condition and most age groups with the expectation of age 28.
  • The average age of participants is 19.9, the median age is 20, and the the IQR is 2. Most participants range from age 18 to 23 with few older than 24.

This information is vital to understand later analyses and to point to possible limitations in the analysis due to the differences in demographics.

Column

Relationship

Column

Analysis

There appears to be a positive relationship between credit hours and GPA for every class except for seniors, where there is negative relationship between GPA and credit hours. This could be due to the fact that seniors have already taken most of the classes that they need to graduate and have the ability to take fewer classes while still maintaining a high GPA. A low senior GPA could be an indication of the presence of factors that would require an individual to take more classes (equates to higher credit hours) in order to graduate. The positive relationship between GPA and credit hours for the rest of the classes may indicate that those who are able to devote full attention to academics are able to take more classes and have more time to study which could help maintain a higher GPA. Though, these are just theories based on the analysis.

The graph also suggests that sophomores have the highest overall GPA, followed by freshmen. This could be due to the fact that freshman and sophomores often have to take general (non-major specific) classes that may require less time and attention allowing for a higher GPA.

Stats

Column

Relationship between stress, GPA, and credit hours

Column

Stress and Class

Analysis

It appears that there is a positive relationship between perceived life stress and the number of credit hours in most GPA groups. In the case of the 2.1-2.5 GPA group, there appears to be a negative relationship between credit hours and life stress, meaning that those taking more credit hours reported lower overall levels of life stress. The graph also shows that those in the lowest GPA group have the highest average level of life stress which increases with credit hours and those in the highest GPA group have the lowest average level of life stress which also increases with credit hours. The boxplot displays that stress for the freshman, sophomore, and junior classes are relatively symmetric while the senior class is left skewed. The senior class also has the highest median level of perceived stress.

I was surprised that the lower GPA group had much higher levels of stress. The scale used to measure stress, the Perceived Stress Scale, measures perceived life stress. This could explain why those in the lower GPA group reported experiencing higher levels of stress as there may be other life stressors that divide attention away from academics. It also can explain why seniors have the highest average stress levels as they are preparing for significant life changes after graduation. As mentioned previously, these are just ideas I came up with to provide possible explanations for the data.

# A tibble: 5 × 2
  GPA_group mean_stress
  <chr>           <dbl>
1 1.6-2.6          24  
2 2.1-2.5          18.6
3 2.6-3.0          19.0
4 3.1-3.5          18.5
5 3.6-4.0          17.1

Column

Pet, Anxiety, Depression

Anxiety

Depression

Column

Analysis

The bar chart evaluates the distribution of participants who meet the criteria to qualify for clinical evidence of disorder and those who do not. Within the groups, those without pets make up a greater portion of the anxiety, depression and both groups. Those with pets make up a smaller portion of the neither group. This may point to evidence that those with pets are less common within those who qualify for clinical evidence of a disorder but there isn’t a strong correlation.

The box plots focus on the raw scores for anxiety and depression. As expected, all of the box plots are right skewed, as most participants have a low to medium score with some having a higher score. There is not a large difference between the pet and no-pet groups, in fact, those with a pet have a higher median depression score, though it is still not high enough to qualify as evidence for clinical depression which explains why those without pets still make up a larger percentage of the depression group in the first bar chart.

I was expecting a stronger correlation between having a pet and improved mental health than was displayed.

Relevent Stats

Column

Cortisol AUC

Average Cortisol Pre to Post

Column

Analysis

The first graph displays the area under the curve for cortisol across all three time points. The experimental group has the largest area under the curve, this could be due to the fact that the therapy dog reduced stress and as a result, the post test cortisol value would be lower, meaning a larger area under the curve. The AUC for the experimental group is also symmetric while the other three groups are right skewed.

The bar graph represents the average cortisol across all timepoints. The experimental group has the lowest average cortisol. This could be a result of the therapy dog reducing stress more than the other conditions.

Cortisol Area under the curve

There are numerous ways to analyze cortisol change and area under the curve is a common measure of cortisol change across timepoints. In this case, the baseline sample was taken when the participants woke up, the second sample was taken right before the experiment and the last sample following the experiment. AUC is often regarded as an accurate way to summarize cortisol reactivity.

Click for further information on AUC

Column

Overview

The present analysis explored the relationship between psychological factors, academic factors and the role of therapy animals in an academic context to reduce stress.

I found the analysis of perceived stress and the academic factors most compelling and insightful, though I was still able to explore the other research questions. The analysis highlighted the role that life stress can impact academic factors and the relationship between academic factors. There may be an impact of having a pet at home and psychological well-being but this idea should be explored further. The impact of the therapy animal as a way to mediate stress should also be further investigated, though this analysis suggests that there is a positive impact on stress reduction.

The results are relevent to all in higher education (students, professors, administators and more), as they examine how different factors can impact well-being and offer possible mediating tools.

Limitations & Furture Direction

Limitations

There are a couple of limitations. First, there were significantly more female than male participants and this may have resulted in discrepancies within the physiological and psychological variables. Using just AUC to summarize the overall impact of the therapy animal could also be a limitation. There were also missing values for academic factors that had to be removed in some cases which is another limitation.

Future Direction

The data was specific to a single university in Washington. In the future, it may be interesting to explore the relationship between academic factors and mental health on a larger scale. I would be interested in adding the variable of university location to the analysis. Location could have significant effects on well-being, as factors such as weather and safety differ significantly around the country. In this case, a map would be a excellent way to visualize the relationship and could offer users a more interactive experience.

Column

About me

My name is Sophia Hollins. I am a junior psychology major at UD with a minor in neuroscience. Post graduation, I hope to attend graduate school in clinical psychology with aspirations to become a pediatric neuropsychologist. My advisor told me about the course and the importance of data analysis in all fields of research so I decided to take MTH 209 to gain a little bit of experience with tools I wouldn’t otherwise get to use.

References

Pendry, P., & Vandagriff, J. L. (2019). Animal Visitation Program (AVP) Reduces Cortisol Levels of University Students: A Randomized Controlled Trial. AERA Open, 5(2). https://doi.org/10.1177/2332858419852592

Stephens, M. A., & Wand, G. (2012). Stress and the HPA axis: role of glucocorticoids in alcohol dependence. Alcohol research : current reviews, 34(4), 468–483.

Westberg, K. H., Nyholm, M., Nygren, J. M., & Svedberg, P. (2022). Mental Health Problems among Young People-A Scoping Review of Help-Seeking. International journal of environmental research and public health, 19(3), 1430. https://doi.org/10.3390/ijerph19031430

---
title: "Decoding Student Stress"
output: 
  flexdashboard::flex_dashboard:
    theme:
      version: 4
      bootswatch: minty
    orientation: columns
    vertical_layout: fill
    source_code: embed
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(DT)
library(plotly)
library(foreign)
library(ggrepel)
project <- read.spss("~/Downloads/PYSA-Sample.sav", to.data.frame = T)
```


<button type="button" class="btn btn-dark disabled">Introduction</button>
===

<h3>Decoding Student Stress: An Exploration of Factors Contributing to College Student Well-Being</h3>

Column {data-width=550}
---
### </blank>
<p class="text-primary"><strong><div style="font-size: 20px;">Background</div></strong></p>

Academic stress, typically psychological in nature, is something that almost every college student has experienced. Stress can lead to the activation of the hypothlamic-pituitary-adrenal axis which releases cortisol. Cortisol is able to provide the cells with extra energy to overcome the stressor but prolonged activation may lead to HPA axis dysregulation. Chronic dysregulation can be attributed to negative health outcomes, both physical and psychological in nature (Westberg et al., 2022). 


<p class="text-primary"><strong><div style="font-size: 20px;">Motivation</div></strong></p>

There is a reported increase in mental health conditions in younger generations, including in college students (Stephens & Wand, 2012). This project aims to explore the impact of different factors on a student's mental well-being and the possible role of animals to mediate stress. As a psychology major, I picked this data set as it is realted to my field of interest.

<p class="text-primary"><strong><div style="font-size: 20px;">Research Questions</div></strong></p>

This analysis aims to explore the following research questions:

- What is the relationship between academic factors of GPA, credit hours and class?

- How do academic factors impact levels of perceived life stress? 

- Is there a relationship between having a pet at home and psychological well-being?

- Does spending time with a therapy dog reduce physiological stress?



Column {.tabset data-width=450}
---

### Data Source and Citation

**Source**

The data was obtained through ICPSR and is licensed under a "Creative Commons Attribution." The data was collected in an experiment that took place at the University of Washington. Subjective psychological measures were self reported by participants and physiological data was collected via saliva for later analysis.

**Citation**

Pendry, Patricia, and VandaGriff, Jaymie . PYSA . Ann Arbor, MI: Inter-university Consortium for Political and Social Research [distributor], 2019-12-18. https://doi.org/10.3886/E116768V1

### Analysis Tools 

**Manipulation**

The original data set contained over 200 variables, many were not relevant to the focus of this analysis and the research questions. Using the dplyr package, I removed data for those that had only completed one part of the study. This was necessary because those participants didn't provide saliva samples so there was no physiological data.I also had to create a new variable called "GPA_group", this allowed me to further examine the relationship between academic variables and psychological variables. 

I picked GPA, credit hours, and class as a representation of academic factors. In order to access stress, I choose the stress total variable over the others as it uses the Perceived Stress Scale to examine one's overall perception of life stress. The psychological variables of interest are anxiety and depression. I had to create a group based on clinical evidence of the conditions in order to visualize the role of a pet at home on mental health. To examine the role of the therapy animal I decided to use cortisol area under the curve and average cortisol.

**Visualization**

In order to assess the relationship between two or more quantitative variables, I utilized a scatter plot with a line to better visualize the correlation. Box plots were also used to examine the distribution of quantitative variables. Box plots were particularly helpful in investigating the distribution of qualitative variables based on quantitative variables. Bar charts were utilized for clear visualizations of the distribution of qualitative variables. 


<button type="button" class="btn btn-dark disabled">Data</button>
===
Column {data-width=550}
---

```{r}
# Removing unnecessary variables

# I am only interested in participants who completed both parts so I am going to remove those who didn't do part 2 or declined


project1 <- project %>%
  filter(part2=="yes") %>%
  select(-c(part2,decline))

# Since there are so many variables, I am going to pick those which are relevant

project2 <- project1 %>% 
  select(c(partid,group,age,sex,class,GPA,credtot,pet,
           depri_tot.1,anx_tot,stress_tot,anxietyclinical,whetherclinicaldepri,cortAUC123, extremecort, avecort123uw))



# remove missing values 
project2 <- project2 %>%
  filter(!is.na(GPA))

#create group for GPA. First, round because values with more than one decimal point would be excluded otherwise.

project2 <- project2 %>%
  mutate(GPA_round=round(GPA,1),GPA_group = case_when(
    GPA_round <= 4.0 & GPA_round >= 3.6 ~ "3.6-4.0",
    GPA_round <=3.5 & GPA_round >= 3.1 ~ "3.1-3.5",
    GPA_round <= 3.0 & GPA_round >=2.6 ~ "2.6-3.0",
    GPA_round <= 2.5 & GPA_round >= 2.1 ~ "2.1-2.5",
    GPA_round <= 2.0 & GPA_round >= 1.6 ~ "1.6-2.6",
    GPA_round <= 1.5 & GPA_round >= 1.1 ~"1.1-1.5",
    GPA_round < 1.0 ~ "0.0-1.0"
  )) %>%
  select(-c(GPA))

```

### </blank>
<p class="text-primary"><strong><div style="font-size: 20px;">Data</div></strong></p>

```{r show_table}
datatable(project2, rownames = FALSE, colnames = c("ID","Group", "Age", "Sex", "Class","Credit hours", "Pet", "Depression total", "Anxiety total", "Stress total", "Clinical anxiety", "Clinical depression","Cortisol AUC", "Extreme cortisol", "Average cortisol","Rounded GPA", "GPA group"), options = list( pageLength =20))
```



Column {data-width=450}
---

### </blank>
<p class="text-primary"><strong><div style="font-size: 20px;">Variable Descriptions</div></strong></p>

- **ID**: participant ID 
- **Group**: group that participant was in
  - Experimental: 1 on 1 time with animal 
  - Slideshow: shown pictures of therapy animals for 10 minutes
  - Observation: observe others interacting with therapy animals
  - Waitlist: control, waited in stimuli free room
- **Age**: participant age
- **Sex**: participant sex
- **Class**: participant's current year of college
- **Credit hours**: total number of credit hours taken in semester
- **Rounded GPA**: participant's rounded GPA
- **GPA group**: GPA group
- **Pet**: whether a participant has a pet at home
- **Depression total**: score on [Beck Depression Inventory](https://doi.org/10.1037/t00741-000)
- **Anxiety total**: score on [Beck Anxiety Inventory](https://doi.org/10.1037/0022-006X.56.6.893) 
- **Stress total**: score on [Perceived Stress Scale](https://doi.org/10.1037/t02889-000)  
- **Clinical anxiety**: grouping based on anxiety total score
- **Clinical depression**: grouping based on depression total score
- **Cortisol AUC**: analysis of cortisol rate of change from pre to post
- **Average Cortisol**: average cortisol across timepoints 
- **Extreme Cortisol**: cortisol reading of at least 3 SD above mean


<button type="button" class="btn btn-dark disabled">Demographics</button>
===
Column {data-width=600}
---

### Distribution of Gender by Group

```{r}
project2 %>% filter(!is.na(sex)) %>%
  ggplot(aes(x=group,fill=sex))+geom_bar()+labs(title = "Distribution of Gender Across Groups", y= "Number of Participants", x="Group")+scale_fill_manual(values =c("#baabc9", "#7a5c8d"))+theme(text = element_text(size = 16))+theme_light() -> bar1
ggplotly(bar1)
```

### Distribution of Gender by Age

```{r bar2}
project2 %>% filter(!is.na(sex)) %>%
  ggplot(aes(x=age,fill=sex))+geom_bar()+scale_x_continuous(breaks=seq(17,28, by=1))+labs(title = "Distribution of Gender by Age", y= "Number of Participants", x="Age")+scale_fill_manual(values =c("#baabc9", "#7a5c8d"))+theme(text=element_text(size=16))+theme_light() -> bar2
ggplotly(bar2)
```

Column {data-width=400}
---

### </blank>

<p class="text-primary"><strong><div style="font-size: 20px;">Analysis</div></strong></p>

These graphs give a brief overview on the make up of participants. A few things should be noted:

- There are a total of 249 participants
- There are more female than male participants in the study. Female participants dominate male participants in every condition and most age groups with the expectation of age 28. 
- The average age of participants is 19.9, the median age is 20, and the the IQR is 2. Most participants range from age 18 to 23 with few older than 24. 

This information is vital to understand later analyses and to point to possible limitations in the analysis due to the differences in demographics. 


<button type="button" class="btn btn-dark disabled">Academic Factors</button>
===

Column {data-width=550}
---

### Relationship
```{r}
project2 %>%
  filter(!is.na(class), !is.na(credtot), !is.na(GPA_round)) %>%
  ggplot(aes(x=GPA_round,y=credtot, color=class))+geom_point(alpha=0.5)+labs(title = "Relationship Between GPA, Class and Credit Hours", x="GPA", y= "Credit Hours")+theme_light()+geom_smooth(se=FALSE, method = "lm")+ scale_color_manual(values =c ("#b5a0d6", "#f8a7b4", "#e5d4ab", "#b9cdc9")) -> scatter1
ggplotly(scatter1)
```



Column {data-width=450}
---

### Analysis

There appears to be a positive relationship between credit hours and GPA for every class except for seniors, where there is negative relationship between GPA and credit hours. This could be due to the fact that seniors have already taken most of the classes that they need to graduate and have the ability to take fewer classes while still maintaining a high GPA. A low senior GPA could be an indication of the presence of factors that would require an individual to take more classes (equates to higher credit hours) in order to graduate. The positive relationship between GPA and credit hours for the rest of the classes may indicate that those who are able to devote full attention to academics are able to take more classes and have more time to study which could help maintain a higher GPA. Though, these are just theories based on the analysis.

The graph also suggests that sophomores have the highest overall GPA, followed by freshmen. This could be due to the fact that freshman and sophomores often have to take general (non-major specific) classes that may require less time and attention allowing for a higher GPA. 

### Stats

```{r}
academic_summary <- project2 %>%
  group_by(class) %>%
  filter(!is.na(class)) %>%
  summarize(mean_GPA=round(mean(GPA_round, na.rm = T),2), median_GPA=median(GPA_round,na.rm=TRUE), 
            mean_cred=round(mean(credtot,na.rm = T),2), median_cred=median(credtot,na.rm=T))
```

```{r}
datatable(academic_summary,rownames = FALSE, colnames = c("Class", "Mean GPA", "Median GPA","Mean Credits", "Median Credits"),caption = htmltools::tags$caption(
    style = 'caption-side: bottom; text-align: center;', htmltools::em('Relevent summary statistics on academic factors.')
  ))
```


<button type="button" class="btn btn-dark disabled">Stress </button> {data-orientation=columns}
===

Column {data-width=550}
---

### Relationship between stress, GPA, and credit hours
```{r}
project2 %>%
  filter(!is.na(class), !is.na(credtot), !is.na(GPA_group)) %>%
  ggplot(aes(x=credtot,y=stress_tot, color=GPA_group))+geom_point(alpha=0.5)+labs(title = "Relationship Between GPA, Stress and Credit Hours", x="Credit Hours", y= "Percieved Stress", legend="GPA")+theme_light()+geom_smooth(se=FALSE, method = "lm")+scale_color_manual(values =c ("#b5a0d6", "#f8a7b4", "#e5d4ab", "#b9cdc9", "#add8e6")) -> scatter2
ggplotly(scatter2)
```

Column {data-width=450}
---

### Stress and Class
```{r}
project2 %>%
  filter(!is.na(class)) %>%
  ggplot(aes(x=class, y=stress_tot)) +geom_boxplot(fill="#baabc9") +
  theme_light() + labs(title = "Stress and Class", y= "Percieved stress", x="Class") -> class1
ggplotly(class1)
```

### Analysis 

It appears that there is a positive relationship between perceived life stress and the number of credit hours in most GPA groups. In the case of the 2.1-2.5 GPA group, there appears to be a negative relationship between credit hours and life stress, meaning that those taking more credit hours reported lower overall levels of life stress. The graph also shows that those in the lowest GPA group have the highest average level of life stress which increases with credit hours and those in the highest GPA group have the lowest average level of life stress which also increases with credit hours. The boxplot displays that stress for the freshman, sophomore, and junior classes are relatively symmetric while the senior class is left skewed. The senior class also has the highest median level of perceived stress.  

I was surprised that the lower GPA group had much higher levels of stress. The scale used to measure stress, the Perceived Stress Scale, measures perceived life stress. This could explain why those in the lower GPA group reported experiencing higher levels of stress as there may be other life stressors that divide attention away from academics.  It also can explain why seniors have the highest average stress levels as they are preparing for significant life changes after graduation. As mentioned previously, these are just ideas I came up with to provide possible explanations for the data.

```{r}
project2 %>%
  group_by(GPA_group) %>%
  summarize(mean_stress=round(mean(stress_tot),2))
```


<button type="button" class="btn btn-dark disabled">Pet</button>
===

Column {.tabset data-width=450}
---


### Pet, Anxiety, Depression
```{r}
relation <- project2 %>%
  mutate(Anxiety_Depression = case_when(
    whetherclinicaldepri == "Moderate to severe depression (20-63)" & anxietyclinical != "Moderate to severe anxiety (BAI 16-63)" ~ "Depression",
    anxietyclinical == "Moderate to severe anxiety (BAI 16-63)" & whetherclinicaldepri != "Moderate to severe depression (20-63)" ~ "Anxiety",
    whetherclinicaldepri == "Moderate to severe depression (20-63)" & anxietyclinical == "Moderate to severe anxiety (BAI 16-63)" ~ "Both",
    TRUE ~ "Neither"
  ))

pet_count <- count(relation, Anxiety_Depression,pet)
pet_count$percent <- round(pet_count$n/sum(pet_count$n)*100,2)
  
bar6 <-  ggplot(pet_count, aes(x=Anxiety_Depression,y=percent, fill = pet))+geom_bar(position = "fill", width = 0.75, stat="identity")+scale_fill_manual(values = c("#baabc9", "#7a5c8d", "#9d74b0", "#d6a7df")) +theme_light() +scale_y_continuous(breaks = seq(0,1,by=0.2), labels=scales::percent)+labs(title = "Distribution of Anxiety and Depression by Pet", x= "Evidence of Anxiety or Depression", y="Percent")
ggplotly(bar6)
```

### Anxiety

```{r}
project2 %>%
  ggplot(aes(x=pet,y=anx_tot))+geom_boxplot(fill="#baabc9")+labs(title = "Relationship Between Anxiety and Pet", x="Pet", y="Total Anxiety") +theme_light() -> box4
ggplotly(box4)
```

### Depression

```{r}
project2 %>%
  ggplot(aes(x=pet,y=depri_tot.1))+geom_boxplot(fill="#baabc9")+labs(title = "Relationship Between Depression and Pet", x="Pet", y="Total Depression") +theme_light() -> box5
ggplotly(box5)
```

Column {data-width=550}
---

### Analysis

The bar chart evaluates the distribution of participants who meet the criteria to qualify for clinical evidence of disorder and those who do not. Within the groups, those without pets make up a greater portion of the anxiety, depression and both groups. Those with pets make up a smaller portion of the neither group. This may point to evidence that those with pets are less common within those who qualify for clinical evidence of a disorder but there isn't a strong correlation. 

The box plots focus on the raw scores for anxiety and depression. As expected, all of the box plots are right skewed, as most participants have a low to medium score with some having a higher score. There is not a large difference between the pet and no-pet groups, in fact, those with a pet have a higher median depression score, though it is still not high enough to qualify as evidence for clinical depression which explains why those without pets still make up a larger percentage of the depression group in the first bar chart. 

I was expecting a stronger correlation between having a pet and improved mental health than was displayed. 



### Relevent Stats

```{r}
pet_summary <- relation %>%
  group_by(pet) %>%
  summarize(
    mean_anx=round(mean(anx_tot),2), mean_dep=round(mean(depri_tot.1),2), IQR_anx=IQR(anx_tot), IQR_dep=IQR(depri_tot.1), median_anx=median(anx_tot), median_dep=median(depri_tot.1)
  )
```

```{r show_table2}
datatable(pet_summary,rownames = FALSE, colnames = c("Pet", "Mean Anxiety", "Mean Depression", "IQR Anxiety", "IQR Depression", "Median Anxiety", "Median Depression"),caption = htmltools::tags$caption(
    style = 'caption-side: bottom; text-align: center;', htmltools::em('Relevent summary statistics on the impact of pets on mental health.')
  ))
```


<button type="button" class="btn btn-dark disabled">Therapy Animal</button>
===

Column {.tabset data-width=450}
---

### Cortisol AUC

```{r}
#filter extreme values
# I used the wakeup cort value as a way to get rid of cortisol values that were 3 SD above mean
# this variable was already created

project2 %>%
  filter(extremecort == "non-extreme cort values") %>%
  ggplot(aes(x=group, y=cortAUC123))+geom_boxplot(fill="#baabc9")+ theme_light() + labs(title = "Distribution of Cortisol AUC by Group", y="Cortisol AUC", x="Group") + ylim(0,6)-> boxcort
ggplotly(boxcort)
# there was one addional outliner that I set limits to remove
```

### Average Cortisol Pre to Post

```{r}
cort_summary <- project2 %>%
  filter(extremecort == "non-extreme cort values") %>%
  group_by(group) %>%
  summarize(mean_cort=round(mean(avecort123uw, na.rm = T),3))

cort_summary %>%
  ggplot(aes(x=group,y=mean_cort))+geom_bar(fill="#baabc9", stat="identity")+ theme_light()+ labs(title = "Average Cortisol", y="Cortisol", x="Group") -> corbar
ggplotly(corbar)
# there was one addional outliner that I set limits to remove
```


Column {data-width=650}
---

### Analysis

The first graph displays the area under the curve for cortisol across all three time points. The experimental group has the largest area under the curve, this could be due to the fact that the therapy dog reduced stress and as a result, the post test cortisol value would be lower, meaning a larger area under the curve. The AUC for the experimental group is also symmetric while the other three groups are right skewed. 

The bar graph represents the average cortisol across all timepoints. The experimental group has the lowest average cortisol. This could be a result of the therapy dog reducing stress more than the other conditions. 


### Cortisol Area under the curve

There are numerous ways to analyze cortisol change and area under the curve is a common measure of cortisol change across timepoints. In this case, the baseline sample was taken when the participants woke up, the second sample was taken right before the experiment and the last sample following the experiment. AUC is often regarded as an accurate way to summarize cortisol reactivity.  

[**Click for further information on AUC**](https://doi.org/10.1016/j.ynstr.2015.04.002) 


<button type="button" class="btn btn-dark disabled">Conclusion</button>
===

Column {data-width=500}
---

### Overview

The present analysis explored the relationship between psychological factors, academic factors and the role of therapy animals in an academic context to reduce stress. 

I found the analysis of perceived stress and the academic factors most compelling and insightful, though I was still able to explore the other research questions. The analysis highlighted the role that life stress can impact academic factors and the relationship between academic factors. There may be an impact of having a pet at home and psychological well-being but this idea should be explored further. The impact of the therapy animal as a way to mediate stress should also be further investigated, though this analysis suggests that there is a positive impact on stress reduction. 

The results are relevent to all in higher education (students, professors, administators and more), as they examine how different factors can impact well-being and offer possible mediating tools.

### Limitations & Furture Direction

**Limitations**

There are a couple of limitations. First, there were significantly more female than male participants and this may have resulted in discrepancies within the physiological and psychological variables. Using just AUC to summarize the overall impact of the therapy animal could also be a limitation. There were also missing values for academic factors that had to be removed in some cases which is another limitation. 

**Future Direction**

The data was specific to a single university in Washington. In the future, it may be interesting to explore the relationship between academic factors and mental health on a larger scale. I would be interested in adding the variable of university location to the analysis. Location could have significant effects on well-being, as factors such as weather and safety differ significantly around the country. In this case, a map would be a excellent way to visualize the relationship and could offer users a more interactive experience.  

Column {data-width=500}
---

### About me

My name is Sophia Hollins. I am a junior psychology major at UD with a minor in neuroscience. Post graduation, I hope to attend graduate school in clinical psychology with aspirations to become a pediatric neuropsychologist. My advisor told me about the course and the importance of data analysis in all fields of research so I decided to take MTH 209 to gain a little bit of experience with tools I wouldn't otherwise get to use. 


### References 

Pendry, P., & Vandagriff, J. L. (2019). Animal Visitation Program (AVP) Reduces Cortisol Levels of University Students: A Randomized Controlled Trial. AERA Open, 5(2). https://doi.org/10.1177/2332858419852592

Stephens, M. A., & Wand, G. (2012). Stress and the HPA axis: role of glucocorticoids in alcohol dependence. Alcohol research : current reviews, 34(4), 468–483. 

Westberg, K. H., Nyholm, M., Nygren, J. M., & Svedberg, P. (2022). Mental Health Problems among Young People-A Scoping Review of Help-Seeking. International journal of environmental research and public health, 19(3), 1430. https://doi.org/10.3390/ijerph19031430